home *** CD-ROM | disk | FTP | other *** search
- /*
- rxresolve: just like resolve
-
- Usage: rxresolve <host>
- rxresolve -s <servicename>
- */
-
- l="rexxsupport.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
- l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
- l="rxsocket.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
-
- parse arg host "-s" serv .
-
- if host="" then
- if serv="" then call usage()
- else call findServ(serv)
- else
- if host="?" then call usage()
- else call findHost(host)
-
- /****************************************************************************/
-
- Usage: PROCEDURE
- say "Usage: rxresolve host"
- say " rxresolve -s servicename"
- exit
-
- /****************************************************************************/
-
- findServ: PROCEDURE
- parse arg serv
-
- if DataType(serv,NUM) then res = GetServByPort("serv",serv,"tcp")
- else res = GetServByName("serv",serv,"tcp")
-
- if ~res then do
- say "Service <" || serv || "> not found."
- exit
- end
-
- say "service:" serv.servname
-
- if serv.servaliases.num~=0 then do
- say "aliases:"
- do i = 0 to serv.servaliases.num-1
- say " " serv.servaliases.i
- end
- end
-
- say "port:" serv.servport
-
- exit
-
- /****************************************************************************/
-
- findHost: PROCEDURE
- parse arg host
-
- if IsDotAddr(host) then res = GetHostByAddr("he",host)
- else res = GetHostByname("he",host)
-
- if ~res then do
- say "Host <" || host || "> not found (" || HostErrorstring() || ")."
- exit
- end
-
- say "host:" he.hostname
-
- if he.hostaliases.num ~= 0 then do
- say "aliases:"
- do i = 0 to he.hostaliases.num-1
- say " " he.hostaliases.i
- end
- end
-
- say "address list:"
- do i = 0 to he.hostaddrlist.num-1
- say " " he.hostaddrlist.i
- end
-
- exit
-
- /****************************************************************************/
-